;; set key for hippie expand
;; http://www.emacswiki.org/emacs/HippieExpand
(global-set-key (kbd "M-/") 'hippie-expand)

;; lisp-fiendly hippie expand
(setq hippie-expand-try-functions-list
      '(try-expand-dabbrev
	try-expand-dabbrev-all-buffers
	try-expand-dabbrev-from-kill
	try-complete-lisp-symbol-partially
	try-complete-lisp-symbol))


;; Highlights matching parenthesis
(show-paren-mode 1)
;; Highlight current line
(global-hl-line-mode 1)

;; set global rainbow delimiters
;; it no longer suport now 
;; see: https://github.com/Fanael/rainbow-delimiters
;;
;;(global-rainbow-delimiters-mode t)

;; set global company-mode
(global-company-mode t)

;; Don't use hard tabs
(setq-default indent-tabs-mode nil)

;; put backupfile into the .emacs.d/backups
(setq backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))))

;; setup auto save mode. DATA IS EVERYTHING
(setq auto-save-default 1)
(setq auto-save-timeout 5)

;; comments
(defun toggle-comment-on-line ()
  (interactive)
  (comment-or-uncomment-region (line-beginning-position) (line-end-position)))

(global-set-key (kbd "M-/") 'toggle-comment-on-line)

;; use 2 spaces for tabs
(defun die-tabs ()
  (interactive)
  (set-variable 'tab-width 2)
  (mark-whole-buffer)
  (untabify (region-beginning) (region-end))
  (keyboard-quit))

(setq electric-indent-mode nil)

;; set column-number-mode
(setq column-number-mode 1)

;; set up projectile
(require 'projectile)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1)
